import Mock from 'mockjs'

const users = Mock.mock({
  'items|10-30': [{
    'userId|+1': 1,
    'phone': /^1(3|4|5|7|8)\d{9}$/,
    'userName': /^1(3|4|5|7|8)\d{9}$/,
    'registerTime': '@datetime',
  }]
})

const accountList = Mock.mock({
  'items|10': [{
    'id|+1': 1,
    'tokenName': /^[A-Z]{3}$/,
    'balance|1-100.1-3': 1,
    'freezeBalance|1-100.1-2': 1,
    'walletAddress|20-30': '',
    'walletBalance|1-100.1-2': 1,
  }]
})

export default [
  {
    url: '/userManage/list',
    type: 'post',
    response: config => {
      const items = users.items
      return {
        code: 10000,
        total: items.length,
        "responseTime": 1548489480000,
        "message": "OK",
        data: items
      }
    }
  },
  {
    url: '/userManage/userDetail',
    type: 'post',
    response: config => {
      const items = accountList.items
      return {
        "code": 10000,//... <number>
        "message": "OK",//... <string>
        "responseTime": 154584845800000,//... <number>
        "data": {//...<object>
          "basisInfo": { //{用户基本信息<object>
            "userId": 100,//用户ID <number>
            "phone": 18542541254,//手机号码 <number>
            "userName": "xiaoming",//用户名 <string>
            "registerTime": "2019-11-30 20:21:45"//注册时间 <string>
          },
          "accountList": items
        }
      }
    }
  },
  {
    url: '/admin/wallet/transferOut',
    type: 'post',
    response: config => {
      return {
        code: 10000,
        "responseTime": 15485100000,
        "message": "OK",
        "data": ""
      }
    }
  },
  {
    url: '/admin/wallet/transferInto',
    type: 'post',
    response: config => {
      return {
        code: 10000,
        "responseTime": 15485100000,
        "message": "OK",
        "data": ""
      }
    }
  },
]
